'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;

  router.get('/', controller.home.index);

  router.get('/test1', controller.test.index);

  router.get('/v1/pn/test', controller.test.test);

  router.post('/v1/pn/login', controller.user.login);

  router.post('/v1/pn/menu/list', controller.menu.list);

  router.post('/v1/pn/menu/create', controller.menu.create);

  router.post('/v1/pn/role/opt', controller.role.create);

  router.post('/v1/pn/role/list', controller.role.list);

  router.get('/v1/pa/user/info', controller.user.info);

  router.post('/v1/pa/menu/getusermenu', controller.menu.getUserMenu);

  router.post('/v1/pn/role/setmenu', controller.role.setMenu);

  router.post('/v1/pn/menu/getmenubyroleid', controller.menu.getMenuByRole);


  
  router.get('/v1/pn/user/list', controller.user.list);
  router.post('/v1/pn/user/list', controller.user.list);


  router.resources('api', '/v1/pn/api', controller.api);


  router.post('/v1/pn/db/databases', controller.database.databases);
  router.post('/v1/pn/db/tables', controller.database.tables);

  router.post('/v1/pn/db/cols', controller.database.cols);


  router.post('/v1/pn/getsql', controller.test.getSql);


  router.post('/v1/pn/createApi', controller.database.createApi);
  router.get('/v1/pn/getApi', controller.database.getApi);
  router.get('/v1/pn/delApi', controller.database.delApi);


  router.get('/v1/pn/cs/list', controller.cs.list);
  router.post('/v1/pn/cs/update', controller.cs.update);
  router.get('/v1/pn/cs/info', controller.cs.info);



  //----- 小程序接口 ---------- //
  router.post('/v1/pn/userlogin', controller.member.login);

  // router.resources('api', '/v1/pn/api', app.controller.common);

};
